import Koa from "koa";

import { logger } from '@/middleware/log'

export default async (
  ctx: Koa.ParameterizedContext<Koa.DefaultState, Koa.DefaultContext, any>,
  next: Koa.Next
) => {
  try {
    await next();
  } catch (err) {
    logger.error(err)
    throw Error(`捕获到了错误${err}`);
  }
};
